var pool = require('../../config/mysql.connection');
var mapping = require('./mapping/utils.mapping');

module.exports = {
	//根据类型获取菜单
	getMenu:function(param,callback){
		pool.getConnection(function(err , connection){
			connection.query(mapping.getLevelMenu,[param.place , param.roleId],function(err , result){
				if(err){
					throw err;
				}
				callback(result);
				connection.release();
			});
		});
	},
	getPower:function(param,callback){
		pool.getConnection(function(err , connection){
			connection.query(mapping.getPower,[param.roleId , param.menuId],function(err , result){
				if(err){
					throw err;
				}
				callback(result);
				connection.release();
			});
		});
	}
};